package com.yuer.rpc.rmi;

import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RmiClientTest {

    public static void main(String[] args) {
        try {
            // 如果RMI Registry就在本地机器上，URL就是:rmi://localhost:9999/xxxx
            // 否则，URL就是：rmi://RMIService_IP:9999/xxxx
            Registry registry = LocateRegistry.getRegistry("127.0.0.1",9999);
            RemoteEmployerCallService remoteEmployerCallService = (RemoteEmployerCallService) registry.lookup("remoteEmployerCallService");
            CoddingDetailModel coddingDetailModel = remoteEmployerCallService.getRemoteCodeDetail(22);
            System.out.println(coddingDetailModel.getCommitMsg());
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (NotBoundException e) {
            e.printStackTrace();
        }
    }
}
